package cn.zwk.request;

import java.util.Collections;
import java.util.Map;

/**
 * HTTP 请求定义：通过模板引擎渲染得到。
 */
public final class HttpRequestDefinition {
    private final HttpMethod method;
    private final String url;
    private final Map<String, String> headers;
    private final String body; // 可为空

    public HttpRequestDefinition(HttpMethod method, String url, Map<String, String> headers, String body) {
        this.method = method;
        this.url = url;
        this.headers = headers == null ? Map.of() : Map.copyOf(headers);
        this.body = body;
    }

    public HttpMethod method() { return method; }
    public String url() { return url; }
    public Map<String, String> headers() { return Collections.unmodifiableMap(headers); }
    public String body() { return body; }
}

